<template>
	<view>
		<web-view :src="viewUrl" ref="wbView" @message="message"></web-view>
	</view>
</template>
<script>
	import * as api from '@/common/api/monitor.js'
	// import AMapGraspRoadDriving from '@/common/util.js'
	export default {
		// props: ['dataList'],
		components: {},
		data() {
			return {
				// 存储轨迹数据
				linePath: {},
				viewUrl: "/hybrid/html/playback-track/index.html",
				options: {
					plateColor: [],
					ccertState: []
				},
				queryData:[]
			}
		},
		onLoad(option) {
			this.queryData = JSON.parse(option.tracking);
		},
		mounted() {
			let that = this
			this.$api.getDict('plate_color').then(res => {
				this.options.plateColor = res.data.data
			})
			//证照状态
			this.$api.getDict("ccert_state").then((res) => {
				this.options.ccertState = res.data.data;
			});

			this.linePath = this.queryData
			this.linePath.option = this.options
			const webview = this.$mp.page.$getAppWebview().children()[0];
			setTimeout(function() {
				webview.evalJS("receiveData('" + JSON.stringify(that.linePath) + "')");
			}, 300); //如果是页面初始化调用时，需要延时一下 
			// api.getPlayBack({
			// 	vehCode: "皖KX5566",
			// 	vehColor: "2",
			// 	startTime: "2023-04-12 00:00:24",
			// 	endTime: "2023-04-15 00:00:24",
			// }).then(res => {
			// 	this.linePath = res.data.data
			// 	// res.data.data.vehTrackInfo.gpsInfoList.map((item) => {
			// 	// 	this.linePath.polylinePath.push([item.lon, item.lat])
			// 	// });
			// 	this.linePath.option = this.options
			// 	const webview = this.$mp.page.$getAppWebview().children()[0];
			// 	setTimeout(function() {
			// 		webview.evalJS("receiveData('" + JSON.stringify(that.linePath) + "')");
			// 	}, 300); //如果是页面初始化调用时，需要延时一下 

			// })


		},
		methods: {
			message(info) {
				this.$emit('fnShow','false')
			}
		}
	};
</script>

<style scoped>
</style>
